<template>
  <el-dialog
    :title="'接口类型'"
    :visible.sync="dialogVisible"
    :close-on-click-modal="false"
    width="850px"
  >
    <div class="form-box">
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="接口类型" prop="iotype">
          <!-- add  del  edit -->
          <el-radio v-model="form.interType" label="add">新增</el-radio>
          <el-radio v-model="form.interType" label="edit">编辑</el-radio>
          <el-radio v-model="form.interType" label="del">删除</el-radio>
        </el-form-item>
        <br />
        <div class="center">
          <el-button @click="close()">取消</el-button>
          <el-button type="primary" @click="submitForm('form')" v-loading="loading">提交</el-button>
        </div>
      </el-form>
    </div>
  </el-dialog>
</template>

<script>
import { push } from "@/api/info/info";
export default {
  name: "push",
  data() {
    return {
      dialogVisible: false,
      loading: false,
      // 表单参数
      form: {
        interType: "add",
        configId:'',
        id:''
      },
      rules: {
       
      }
    };
  },
  created() {
    // this.uploadImgUrl = process.env.VUE_APP_BASE_API + "/upload/image";
  },
  methods: {
    // 打开弹窗
    open(data) {
      this.form.id = data.id
      this.form.configId = data.configId
      this.dialogVisible = true;
    },
    submitForm(formName) {
      this.$refs["" + formName].validate(valid => {
        if (valid) {
          push(this.form).then(res=>{
            this.dialogVisible = false;
          })
          
        } else {
          this.$alert("请填写完整！");
        }
      });
    },
    close() {
      this.dialogVisible = false;
    }
  }
};
</script>
<style scoped lang="css">
.center {
  text-align: center;
}
.form-box {
  padding-top: 20px;
}
</style>
